package pers.goetboy.sys.controller;

import org.springframework.web.bind.annotation.*;
import pers.goetboy.common.AbstractController;
import pers.goetboy.sys.model.entity.Dict;
import pers.goetboy.sys.services.DictService;

import java.util.List;

/**
 * 分组管理
 *
 * @author:goetb
 * @date 2019 /02 /13
 **/
@RestController("/dict")
public class DictController extends AbstractController<Dict,DictService> {

    /**
     * 通过父code获取子节点
     *
     * @param parentCode
     * @return
     */
    @GetMapping("/list/{parentCode}")
    public List<Dict> listTreeByParentCode(@PathVariable String parentCode) {
        return service.listByParentCode(parentCode);
    }


    /**
     * 通过code查询字典对象
     *
     * @param code 字典编码
     * @return 字典对象
     */
    @GetMapping(value = "/get/code/{code}")
    public Dict getByCode(@PathVariable String code) {
        return service.getByCode(code);
    }


}
